home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sun Solutions 2000 #2
/
Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO
/
products
/
Software
/
PlanetIntra
/
_install
/
launchit.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
2000-02-17
|
6KB
|
248 lines
#!/bin/sh
if [ "$HOME" = "" ]; then
HOME="/"; export HOME
fi
#
# Generic launch script for use with MDSS cdrom mechanism
#
# marc.sacoolas@sun.com
#
#**********************
# Begin subs
#**********************
# Check if user wants to be root
check_root_maybe() {
if [ "$USER" != "root" ]; then
while true
do
echo ""
echo "You may need to be root user to install this software in certain directories. \c"
echo ""
echo "Would you like to become root user? <[y/n] n> \c"
read ans
if [ "$ans" = "" ]; then
ans="n"
fi
case "$ans" in
y|Y|yes|YES) echo "";echo "Enter super user \c";su root -c 'USER=root;export USER;$COMPANY_DIR/_install/launchit.sh $theARGS';exit 0
;;
N|Q|n|q|No|quit|NO|QUIT|Quit) break
;;
esac
done
fi
}
# Check if root - manditory
check_root() {
if [ "$USER" != "root" ]; then
while true
do
echo ""
echo "You need to be super user to install this software. \c"
echo ""
echo "Would you like to continue with the installation? <[y/n] y> \c"
read ans
if [ "$ans" = "" ]; then
ans="y"
fi
case "$ans" in
y|Y|yes|YES) echo "";echo "Enter super user \c";su root -c 'USER=root;export USER;$COMPANY_DIR/_install/launchit.sh $theARGS';exit 0
;;
N|Q|n|q|No|quit|NO|QUIT|Quit) end_it
;;
esac
done
fi
}
# terminate installation
end_it () {
echo " "
echo $1
echo " "
echo "Hit return to end ..."
echo " "
read answer
exit 0
}
# prompt to remove stuff before terminating
end_it_rm () {
cd $HOME
echo ""
echo "Remove demo directory $installdir?"
echo "\n<[y/n] y>\c";read x
if [ "$x" = "" ];then x="y"
fi
if [ $x = "n" -o $x = "no" -o $x = "No" -o $x = "N" ];then
exit 0
fi
if [ $x = "y" -o $x = "yes" -o $x = "Yes" -o $x = "Y" ];then
rm -rf $installdir
if [ -d $path ]; then
echo ""
echo "Could not remove installation directory."
echo ""
end_it
fi
else
end_it_rm
fi
}
# if prompt is required, do so
prompt_choice() {
echo ""
echo "Which package from Network Engineering Software would you like to install?\n"
echo ""
echo "1) Telaxian Shield firewall server"
echo "2) Sky Light web server"
echo ""
echo "3) Exit installation."
echo ""
echo "Enter your selection: \c"
read answer
case "$answer" in
1) WHICHPROD="shield.tar.Z"
WHICHPRODNAME="Telaxian Shield"
WHICHSCRIPT="NETINST"
WHICHDIR="install"
;;
2) WHICHPROD="install-www-ssl.tar.Z"
WHICHPRODNAME="Sky Light"
WHICHSCRIPT="webinst"
WHICHDIR="install-www-ssl"
;;
3) end_it
;;
*) echo "Please choose one."
prompt_choice
;;
esac
}
# if choice driven by .demosh script:
auto_choice () {
case "$1" in
1) #WHICHPROD=""
WHICHPRODNAME="Planet Intra"
install_script="install"
;;
2) WHICHPROD="NotifyServer"
WHICHPRODNAME="IPnetWATCHER Notification Server"
installdir=NotificationServer11woJRE
;;
esac
}
# if system installation is required
prompt_path () {
installdir="$HOME"
echo ""
echo "Please enter an install path to begin installing $WHICHPRODNAME:"
echo "\n<$installdir>\c";read path
if [ -n "$path" ]; then
installdir="$path"
fi
verify_path $installdir
}
verify_path () {
installdir=$1
if [ ! -d $installdir ]; then
echo "$installdir does not exist, create it?"
echo "\n<[y/n] y>\c";read x
if [ "$x" = "" ];then x="y"
fi
if [ $x = "y" -o $x = "yes" -o $x = "Yes" -o $x = "Y" ];then
mkdir -p $installdir
if [ ! -d $installdir ]; then
echo ""
echo "Could not create destination directory."
prompt_path
fi
else
end_it "A destination directory needs to be specified."
fi
fi
if [ ! -w $installdir ];then
echo "You can not write to $installdir"
prompt_path
fi
FREE_SPACE=0
df=/tmp/FREE.$$
/usr/bin/df -k $installdir | sed /kbytes/d | sed -e '3,$d' | sed -e '1,$s/ */ /g' > $df
case `/usr/bin/wc -l $df | sed -e 's/^ *//' | cut -f1 -d" " ` in
1) FREE_SPACE=`cat $df | cut -f4 -d" "` ;;
2) FREE_SPACE=`cat $df | sed 1d | sed 's/^ *//' | cut -f3 -d" "` ;;
esac
if [ -n $FREE_SPACE ]
then
if [ $FREE_SPACE -lt $PRODUCT_SIZE ]
then
echo
echo "The product installation requires $PRODUCT_SIZE kbytes of"
echo "free disk space. There is only $FREE_SPACE kbytes of free"
echo "disk space in the selected filesystem. Please free up some"
echo "disk space, or choose another directory."
prompt_path
fi
fi
/bin/rm $df 2>/dev/null
return 0
}
#*****************
# end subs
#*****************
#Variables
theARGS=$1
PRODUCT_SIZE='1000'
WHICHPROD=
WHICHPRODNAME=
#installdir= $COMPANY_DIR/_install
export PRODUCT_SIZE WHICHPROD WHICHPRODNAME installdir theARGS
echo ""
echo
## Call out Subs here ###
#check_root
#check_root_maybe
auto_choice $theARGS
#prompt_choice
#prompt_path
# below is custom for each demo
echo ""
echo "$WHICHPRODNAME installation starting..."
echo ""
echo ""
echo ""
echo "This may take a few minutes..."
echo ""
#mkdir -p $installdir
#cp $COMPANY_DIR/_install/install.zip $installdir
#chmod -R 777 $installdir
cd $COMPANY_DIR/_install
#unset JAVA_HOME
#unset CLASSPATH
#JAVA_HOME=$CD_MOUNT/products/bin/java/$CDWARE_ENV/bin/
#CLASSPATH=$COMPANY_DIR/_install/bin/dtCoreEngine.jar:$COMPANY_DIR/_install/bin/dtDefPlugins.jar:$COMPANY_DIR/_install/bin/ke31lib.jar:$COMPANY_DIR/_install/bin/pj.jar
#export CLASSPATH
#$CD_MOUNT/products/bin/java2/$CDWARE_ENV/bin/java espial.devicetop.system.DevicetopImpl
#/tmp/solcd/.cgi-bin/gunzip -c $COMPANY_DIR/_install/$WHICHPROD | tar xvf -
#chmod 777 $install_script
./$install_script
#rm -r $installdir
end_it